Name :Add count

Symbol:CTU

Illustrate:

    You can use the Add Count command to increment the value of the output CV. If the signal status of the input CU changes from "0" to "1" (signal rising edge), the command is executed while the current counter value of the output CV is added to 1. Each time a rising edge of the signal is detected, the counter value is incremented until the upper limit of the data type specified in the output CV is reached. When the upper limit is reached, the signal state of the input CU will no longer affect the instruction.
    You can query the counter status in the Q output. The signal state of the output Q is determined by the parameter PV. If the current counter value is greater than or equal to the value of the parameter PV, the signal status of the output Q is set to "1". In all other cases, the signal status of the output Q is "0".
    When the signal status of input R1 changes to "1", the value of the output CV is reset to "0". As long as the signal status of input R1 remains "1", the signal status of the input CU will not affect the instruction. 

Image:

Parameter:

Parameter Statement Type Description
CU Input BOOL
Count input
R Input BOOL
Reset input
PV Input INT
Set the output value of Q
Q Output BOOL
Counter status
CV Output INT
The current counter value

Example:

LD:

ST:



Interpretation:

    When the signal status of the "TagIn1" operand changes from "0" to "1", the "Add Count" command is executed, and the current counter value of the "TagCV" operand is increased by 1. With each additional signal rising edge detected, the counter value is incremented until the upper limit of that data type (INT=32767) is reached.
    The value of the PV parameter is used as a limit to determine the output of "TagOut". As long as the current counter value is greater than or equal to the value of the operand "TagPV", the signal status of the output "TagOut" is "1". In all other cases, the signal status of the output "TagOut" is "0".